<!DOCTYPE html>



  


<html class="theme-next muse use-motion" lang="zh-CN">
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/hexo/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/hexo/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/hexo/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/hexo/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/hexo/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/hexo/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/hexo/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="开发笔记,">










<meta name="description" content="距离上次写blog，已经过去1个月了，近期由于项目不断在推进，所以没时间写。本来这篇想聊聊分布式的一些小知识点的，也是由于时间紧张，先不写了吧，正好在写一个从自动化工具，其中包含了从百度网盘下载文件的业务，就单拎出来聊一聊。上篇关于怎么接入百度网盘开放平台已经有了一些介绍，然后上篇主要聊了聊上传，这篇来聊聊下载，而关于授权之类的操作，就不多说了。关于下载，网盘的api文档给的介绍也是惜字如金，不过">
<meta name="keywords" content="开发笔记">
<meta property="og:type" content="article">
<meta property="og:title" content="薅bd的羊毛?-2（从百度网盘下载文件）">
<meta property="og:url" content="https://tony_df.coding.net/2020/06/21/薅bd的羊毛-2/index.html">
<meta property="og:site_name" content="Tony&#39;s blog">
<meta property="og:description" content="距离上次写blog，已经过去1个月了，近期由于项目不断在推进，所以没时间写。本来这篇想聊聊分布式的一些小知识点的，也是由于时间紧张，先不写了吧，正好在写一个从自动化工具，其中包含了从百度网盘下载文件的业务，就单拎出来聊一聊。上篇关于怎么接入百度网盘开放平台已经有了一些介绍，然后上篇主要聊了聊上传，这篇来聊聊下载，而关于授权之类的操作，就不多说了。关于下载，网盘的api文档给的介绍也是惜字如金，不过">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https://tony_df.coding.net/2020/06/21/薅bd的羊毛-2/1.png">
<meta property="og:image" content="https://tony_df.coding.net/2020/06/21/薅bd的羊毛-2/2.png">
<meta property="og:image" content="https://tony_df.coding.net/2020/06/21/薅bd的羊毛-2/curl_download.png">
<meta property="og:image" content="https://tony_df.coding.net/2020/06/21/薅bd的羊毛-2/wget_download.png">
<meta property="og:updated_time" content="2020-06-21T04:31:33.643Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="薅bd的羊毛?-2（从百度网盘下载文件）">
<meta name="twitter:description" content="距离上次写blog，已经过去1个月了，近期由于项目不断在推进，所以没时间写。本来这篇想聊聊分布式的一些小知识点的，也是由于时间紧张，先不写了吧，正好在写一个从自动化工具，其中包含了从百度网盘下载文件的业务，就单拎出来聊一聊。上篇关于怎么接入百度网盘开放平台已经有了一些介绍，然后上篇主要聊了聊上传，这篇来聊聊下载，而关于授权之类的操作，就不多说了。关于下载，网盘的api文档给的介绍也是惜字如金，不过">
<meta name="twitter:image" content="https://tony_df.coding.net/2020/06/21/薅bd的羊毛-2/1.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/hexo/',
    scheme: 'Muse',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: 'Tony'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://tony_df.coding.net/2020/06/21/薅bd的羊毛-2/">





  <title>薅bd的羊毛?-2（从百度网盘下载文件） | Tony's blog</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/hexo/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Tony's blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">学着码代码,学着码人生;</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/hexo/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-question-circle"></i> <br>
            
            Home
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/hexo/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-question-circle"></i> <br>
            
            Tags
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/hexo/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-question-circle"></i> <br>
            
            Archives
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://tony_df.coding.net/hexo/2020/06/21/薅bd的羊毛-2/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Tony">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/hexo/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Tony's blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">薅bd的羊毛?-2（从百度网盘下载文件）</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">Posted on</span>
              
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2020-06-21T11:58:24+08:00">
                2020-06-21
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>距离上次写blog，已经过去1个月了，近期由于项目不断在推进，所以没时间写。本来这篇想聊聊分布式的一些小知识点的，也是由于时间紧张，先不写了吧，正好在写一个从自动化工具，其中包含了从百度网盘下载文件的业务，就单拎出来聊一聊。<br>上篇关于怎么接入百度网盘开放平台已经有了一些介绍，然后上篇主要聊了聊上传，这篇来聊聊下载，而关于授权之类的操作，就不多说了。<br>关于下载，网盘的api文档给的介绍也是惜字如金，不过还是那句话，能力都放开给你了，还要什么自行车。<br>经过一番折腾，算是有了点门道，简单在这里总结一下。<br>首先来说下载工具，接口上的例子是用的curl，但一般我们用curl都是来做一些测试性的操作，比如模拟表单提交等。虽然curl也能通过指定参数来进行下载操作，但一般我下载还是习惯用wget。<br>关于这两个工具的介绍，推荐一篇<a href="https://blog.csdn.net/yushupan/article/details/83578633" target="_blank" rel="noopener">https://blog.csdn.net/yushupan/article/details/83578633</a>（尽管我很不喜欢csdn的分享风格，但这篇写的还不错）。<br>好了，不扯了，来看看下载步骤。<br>这里我还是配合postman来演示。<br>1.根据接口介绍，要下载文件的话，需要获取一个关键参数——dlink.<br>而要获取这个参数，首先要得到文件的基本信息，可以通过列表接口或者搜索接口来获取，如下<br><img src="1.png" alt="1"><br>关键的内容是接口地址：<a href="https://pan.baidu.com/rest/2.0/xpan/file?method=search" target="_blank" rel="noopener">https://pan.baidu.com/rest/2.0/xpan/file?method=search</a>，以及响应内容中的fs_id这个参数。<br>通过fs_id这个参数就可以去获取dlink了<br>2.获取dlink<br><img src="2.png" alt="2"><br>获取dlink了之后，我们就可以去下载这个文件了，注意下载的时候这个dlink中也要加上access_token参数才可以下载，且dlink是有有效期的，一般是8个小时内有效（绝大多数文件8小时内都能下载完成吧）。<br>在看下载<br>首先是通过curl下载，注意，Windows下使用curl的话，需要先下载curl环境才行，同样wget也是，这两个工具都是linux下的原生工具。<br>我这里演示Ubuntu18.04环境下的下载。<br><img src="curl_download.png" alt="curl_download"><br>再来看看通过wget下载<br><img src="wget_download.png" alt="wget_download"><br>这里因为我也是刚开始测试，发现这个wget在Windows环境下无法下载dlink文件，在linux环境下就可以，还没查到原因。还要指出的一点是，wget下载的速度比curl快很多！<br>正如我分享的哪个链接里所说，如果你是单纯的下载需求，用wget更合适。<br>好了，流程搞明白后，得到结论是可以通过接入网盘接口，来实现自动化的下载服务。<br>我这里简单写了点代码，还没做整理，又怕接下来一段时间又没时间更博了，就先这样记录一下吧。<br>对照上面的流程，首先是对接搜索的接口，获取fs_id</p>
<figure class="highlight c#"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//搜索网盘文件，获取fs_id</span></span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> BdNasFileResultModel <span class="title">SearchFile</span>(<span class="params"><span class="keyword">string</span> filename</span>)</span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">    <span class="keyword">var</span> token = GetAccessToken().access_token;</span><br><span class="line">    <span class="keyword">string</span> url = <span class="string">$"https://pan.baidu.com/rest/2.0/xpan/file?method=search&amp;key=<span class="subst">&#123;filename&#125;</span>&amp;access_token=<span class="subst">&#123;token&#125;</span>&amp;recursion=1"</span>;</span><br><span class="line">    <span class="keyword">string</span> ret = Common.RequestHelper.HttpGet(url, <span class="string">"application/json"</span>);</span><br><span class="line">    BdNasFileResultModel ret_model = <span class="keyword">new</span> BdNasFileResultModel();</span><br><span class="line">    <span class="keyword">if</span> (ret.Contains(<span class="string">"\"errno\":0"</span>))</span><br><span class="line">    &#123;</span><br><span class="line">        ret_model = JsonHelper.JsonDeserialize&lt;BdNasFileResultModel&gt;(ret);</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">return</span> ret_model;</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">//搜索接口数据返回模型</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title">BdNasFileResultModel</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">int</span> errno &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> List&lt;BdNasFileInfoModel&gt; list &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">long</span> request_id &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">int</span> has_more &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">//搜索接口关键数据列表模型</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title">BdNasFileInfoModel</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">long</span> fs_id &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">string</span> path &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">string</span> server_name &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">long</span> size &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">long</span> server_mtime &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">long</span> server_ctime &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">long</span> local_mtime &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">long</span> local_ctime &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">int</span> isdir &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">int</span> category &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">int</span> share &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">long</span> oper_id &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">int</span> extent_tinyint1 &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">string</span> md5 &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>然后，通过fs_id获取dlink</p>
<figure class="highlight c#"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//单文件下载</span></span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> BdNasFileDetailResultModel <span class="title">GetFileDetail</span>(<span class="params"><span class="keyword">long</span> fsid</span>)</span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">    <span class="keyword">var</span> token = GetAccessToken().access_token;</span><br><span class="line">    <span class="keyword">string</span> url = <span class="string">$"https://pan.baidu.com/rest/2.0/xpan/multimedia?method=filemetas&amp;fsids=[<span class="subst">&#123;fsid&#125;</span>]&amp;access_token=<span class="subst">&#123;token&#125;</span>&amp;dlink=1"</span>;</span><br><span class="line">    <span class="keyword">string</span> ret = RequestHelper.HttpGet(url, <span class="string">"application/json"</span>);</span><br><span class="line">    BdNasFileDetailResultModel ret_model = <span class="keyword">new</span> BdNasFileDetailResultModel();</span><br><span class="line">    <span class="keyword">if</span> (ret.Contains(<span class="string">"\"errno\":0"</span>))</span><br><span class="line">    &#123;</span><br><span class="line">        ret_model = JsonHelper.JsonDeserialize&lt;BdNasFileDetailResultModel&gt;(ret);</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">return</span> ret_model;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">//文件详情返回数据模型</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title">BdNasFileDetailResultModel</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">string</span> errmsg &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">int</span> errno &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> List&lt;BdNasFileDetailModel&gt; list &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">long</span> request_id &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">dynamic</span> names &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">//文件详情，含dlink</span></span><br><span class="line"><span class="keyword">public</span> <span class="keyword">class</span> <span class="title">BdNasFileDetailModel</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">int</span> category &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">string</span> dlink &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">string</span> filename &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">long</span> fs_id &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">int</span> isdir &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">string</span> md5 &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">long</span> oper_id &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">string</span> path &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">long</span> server_ctime &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">long</span> server_mtime &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">public</span> <span class="keyword">long</span> size &#123; <span class="keyword">get</span>; <span class="keyword">set</span>; &#125;</span><br><span class="line">    &#125;</span><br></pre></td></tr></table></figure>

<p>至此，和百度网盘的对接告一段落，开始借助curl进行下载，这段我就不贴了，就是调用curl和调用cmd.exe步骤是一样的，就是注意下参数拼接即可。<br>好了，下载的流程比起上传来说要简单许多，之所以自己开发时因为业务需要，市面上的网盘下载工具无法满足或者满足的不够好。好了就先这样吧，得接着搬砖去了。</p>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/hexo/tags/开发笔记/" rel="tag"># 开发笔记</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/hexo/2020/05/21/薅bd的羊毛/" rel="next" title="薅bd的羊毛?-1（上传文件到百度网盘）">
                <i class="fa fa-chevron-left"></i> 薅bd的羊毛?-1（上传文件到百度网盘）
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/hexo/2020/06/29/分享一个支持断点续传的大文件分片上传的小模块/" rel="prev" title="分享一个支持断点续传的大文件分片上传的小模块">
                分享一个支持断点续传的大文件分片上传的小模块 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
        <!-- Go to www.addthis.com/dashboard to customize your tools -->
<div class="addthis_inline_share_toolbox">
  <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5bbb2338b87602f0" async="async"></script>
</div>

      
    </div>
  </div>


          </div>
          


          

  
    <div class="comments" id="comments">
      <div id="lv-container" data-id="city" data-uid="MTAyMC8zOTA1My8xNTU4MA"></div>
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      

      <section class="site-overview-wrap sidebar-panel sidebar-panel-active">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">Tony</p>
              <p class="site-description motion-element" itemprop="description">学习总结</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/hexo/archives/">
              
                  <span class="site-state-item-count">58</span>
                  <span class="site-state-item-name">posts</span>
                </a>
              </div>
            

            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/hexo/tags/index.html">
                  <span class="site-state-item-count">7</span>
                  <span class="site-state-item-name">tags</span>
                </a>
              </div>
            

          </nav>

          

          

          
          

          
          

          

        </div>
      </section>

      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Tony</span>

  
</div>


  <div class="powered-by">Powered by <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a></div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">Theme &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Muse</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/hexo/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/hexo/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/hexo/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/hexo/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/hexo/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/hexo/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/hexo/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/hexo/js/src/motion.js?v=5.1.4"></script>



  
  

  
  <script type="text/javascript" src="/hexo/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/hexo/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/hexo/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  
    <script type="text/javascript">
      (function(d, s) {
        var j, e = d.getElementsByTagName(s)[0];
        if (typeof LivereTower === 'function') { return; }
        j = d.createElement(s);
        j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
        j.async = true;
        e.parentNode.insertBefore(j, e);
      })(document, 'script');
    </script>
  












  





  

  

  

  
  

  

  

  

</body>
</html>
